﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Reviewer.Business;
using Reviewer.Entities.Services;
using Reviewer.Entities;

public partial class CMSV2_FrontPagePostList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (IFrontPagePostService service = ServiceFactory.FrontPagePostService)
            {
                ICollection<FrontPagePost> posts = service.FindAll(22);

                foreach(FrontPagePost post in posts.Where(t => !t.IsActive))
                {
                    this.uiBlInactivePosts.Items.Add(
                        new ListItem(
                            post.Title, ResolveUrl("FrontPagePostManager.aspx?Id=" + post.Id)
                        ));
                }

                foreach(FrontPagePost post in posts.Where(t => t.IsActive))
                {
                    this.uiBlActivePosts.Items.Add(
                        new ListItem(
                            post.Title, ResolveUrl("FrontPagePostManager.aspx?Id=" + post.Id)
                        ));
                }
            }
        }
    }
}
